package cn.itsource.langxun.controller;

import cn.itsource.langxun.domain.User;
import cn.itsource.langxun.util.AjaxResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @RequestMapping("/login")
    public AjaxResult login(@RequestBody User user){
        //模拟登录lishijie，123
        String username =  user.getUsername();
        String password = user.getPassword();
        if("admin".equals(username)&&"123456".equals(password)){
        user.setPassword(null);
        return AjaxResult.li().setSuccess(true).setMessage("登录成功啦").setRestobj(user);

        }
        return AjaxResult.li().setSuccess(false).setMessage("登录失败啦");
    }
}
